clear

set scheme plotplain

use Data_Proc\recs_clean

collapse (mean) ageu0 ageu1 ageu2 ageu3 ageu4 [pw = nweight], by(recs)

reshape long ageu, i(recs) j(age)

ren ageu share

replace age= 4-age
sort recs age

gen labelvar = share
replace labelvar = . if age==0
format labelvar %9.3f

la var age "Heating equipment age (years)"

la var share "Share of households"

twoway (scatter share age if recs==2020, m(o) mcolor(black) c(l) lcolor(black) mlabel(labelvar) mlabpos(12) mlabgap(2) lcolor(black) xlabel(4 "<2" 3 "<5" 2 "<10" 1 "<20" 0 "All") legend(order(1 "RECS 2020" 2 "RECS 2015" 3 "RECS 2009") position(0) bplacement(ne))) (line share age if recs==2015) (line share age if recs==2009)
graph export Final_Output\fig_age_cumulative_OLD_AllRECS.png, as(png) replace


clear
exit